package com.coincalf.exchange.service;

import com.baomidou.mybatisplus.service.IService;
import com.coincalf.exchange.entity.EntrustOrder;
import com.coincalf.framework.enums.OrderStatus;
import com.coincalf.framework.enums.OrderType;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 委托订单信息 服务类
 * </p>
 *
 * @author qiang
 * @since 2018-05-12
 */
public interface EntrustOrderService extends IService<EntrustOrder> {

    /**
     * 查询能与之撮合的委托订单
     *
     * @param marketId  交易对ID
     * @param orderType 委托订单类型
     * @param price     委托价格
     * @return
     */
    List<EntrustOrder> queryMatchEntrustOrder(Long marketId, OrderType orderType, BigDecimal price);

    /**
     * 修改币币交易委托订单
     *
     * @param orderId            委托订单号
     * @param lockAmount         冻结金额
     * @param dealVolume         当前成交量
     * @param entrustOrderStatus 委托订单状态
     */
    int modifyTradeEntrustOrder(long orderId, BigDecimal lockAmount, BigDecimal dealVolume, OrderStatus entrustOrderStatus);

    /**
     * 将委托订单状态修改为已成交
     *
     * @param orderId 订单号
     * @return
     */
    int modifyTradeEntrustOrderToDeal(long orderId);

    /**
     * 修改占用保证金
     *
     * @param orderId    订单号
     * @param lockMargin 占用保证金
     * @return
     */
    int modifyLockMargin(long orderId, BigDecimal lockMargin);
}
